finp$="picture.gif"

fout$=finp$+".bin"
' converts a 128x192 4c picture into a 'pmode3:screen1,0' binary file
setdisplay(128,192,32,1):paper(8^8-1):ink(0):pen(0):cls
loadimage(finp$,1):pasteicon(0,0,1)
open fout$ for output as #1
for y=0 to 191
  for x1=0 to 31
    btv=0:btt=0
    for x2=3 to 0 step -1
      btv=btv*4
      u=point(x1*4+(3-x2),y)
      b=u mod 256: u=int(u/256)
      g=u mod 256: u=int(u/256)
      r=u mod 256: u=int(u/256)
      btt=0
      if r>128 then:btt=1:end if
      if g<128 then:btt=2:end if
      if r>128 and g<128 then:btt=3:end if
      btv=btv+btt
      next
    writebyte(1,btv)
    next:next
close #1
'waitkey

